<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    div{
      margin: 30px;
      border: 5px solid #000;
      /* width: 200px;
      height: 100px; */
      padding: 20px;
      /* box-sizing: border-box;  IE盒模型 */
      /* box-sizing: content-box;  标准盒模型 */
    }
  </style>
</head>
<body>
  <div id="wrap" style="width: 200px; height: 100px;">hello world</div>

  <script>
    let dom =document.getElementById('wrap')
    // dom.style.width = 300 + 'px'
    // console.log(dom.style.width)

    // dom.offsetWidth = 300 + 'px'  //不能设置
    // console.log(dom.offsetWidth);  //能获取

    // dom.getBoundingClientRect().width = 300 + 'px'   //不能设置
    // console.log(dom.getBoundingClientRect())    //能获取

    // window.getComputedStyle(dom).width = 300 + 'px' //不能设置
    // console.log(window.getComputedStyle(dom).width)  //能获取

    // console.log(dom.currentStyle.width)
  </script>
</body>
</html>